package com.etc.service;

import com.etc.dao.IUserDao;
import com.etc.entity.Admin;
import com.etc.entity.Business;
import com.etc.entity.User;
import com.etc.entity.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {

   @Autowired
   IUserDao userDao;
// 查询所有的User
   public List<User> queryAllUsers() {
       return userDao.queryAllUsers();
   }
// 查询指定页码的User
   public List<Users> queryUsers(int page) {
       return userDao.queryUsers(page*5);
   }
// 查询指定id的User
   public List<Users> queryUsersFilter(int page, String nickname) {
       return userDao.queryUsersFilter(page*5, nickname);
   }
// 搜索指定page和昵称的User集合
   public int queryAllUsersFilter(String nickname) {
       return userDao.getAllFilter(nickname);
   }
// 查询指定id的User
   public Users queryUsers3(int id) {
       return userDao.queryUsers3(id);
   }
// 获取总数量
   public int getAll() {
	   
       return userDao.getAll();
   }
// 更新User
   public int updateUsers(Users u) {
	   return userDao.updateUsers(u);
   }
   

// 删除指定id的User
   public int deleteUsers(int id) {
	  return userDao.deleteUsers(id);
   }
// 是否存在指定身份证号的User
   public boolean existCard(String card) {
	   if (userDao.existCard(card) >= 1) {
		   return true;
	   }
	   return false;
   }


   //登录
    public List<Admin> check(String username,String pwd){
       return userDao.check(username,pwd);
    }
    public List<Business> checkBus(String id, String pwd){
        return userDao.checkBus(id,pwd);
    }


    /**
     * 注册
     */
    public int logon(String id,String name,String pwd){return userDao.logon(id,name,pwd);}


    /**
     * 查重
     */
    public int Duplicatecheck(String id){return userDao.Duplicatecheck(id);}


}
